package dto

import (
	"tuowei.com/app/admin/models"
	"tuowei.com/common/dto"
	common "tuowei.com/common/models"
)

type SysConsultLBTGetPageReq struct {
	dto.Pagination         `search:"-"`
	ConsultLBTName         string `form:"consult_lbt_name" json:"consult_lbt_name" search:"type:exact;column:consult_lbt_name;table:sys_consult_lbt" comment:"轮播图名称"`                         // 轮播图名称
	LBTUrl                 string `form:"lbt_name_url" json:"lbt_name_url" search:"type:exact;column:lbt_name_url;table:sys_consult_lbt" comment:"轮播图连接"`                                     // 轮播图连接
	ConsultLBTIntroduction string `form:"consult_lbt_introduction" json:"consult_lbt_introduction" search:"type:exact;column:consult_lbt_introduction;table:sys_consult_lbt" comment:"轮播图说明"` // 轮播图说明
	UploadUser             string `form:"upload_user" json:"upload_user" search:"type:exact;column:upload_user;table:sys_consult_lbt" comment:"上传人"`                                          // 上传人
	LbtType                string `form:"lbt_type" json:"lbt_type" search:"type:exact;column:lbt_type;table:sys_consult_lbt" comment:"图类型，1为首页，2为政策咨询"`                                       //图类型，1为首页，2为政策咨询
	Province               string `form:"province" json:"province" search:"type:contains;column:province;table:sys_consult_lbt" comment:"适用地区"`
}

func (m *SysConsultLBTGetPageReq) GetNeedSearch() interface{} {
	return *m
}

type SysConsultLBTInsertReq struct {
	ConsultLBTId           int    `uri:"consult_lbt_id" comment:"轮播图ID"`            // 轮播图ID
	ConsultLBTName         string `json:"consult_lbt_name" comment:"轮播图名称"`         // 轮播图名称
	LBTUrl                 string `json:"lbt_name_url" comment:"轮播图连接"`             // 轮播图连接
	LBTSkipUrl             string `json:"lbt_skip_url" comment:"轮播图连接"`             // 轮播图跳转链接
	ConsultLBTIntroduction string `json:"consult_lbt_introduction" comment:"轮播图说明"` // 轮播图说明
	LbtType                string `json:"lbt_type" comment:"图类型，1为首页，2为政策咨询"`       //图类型，1为首页，2为政策咨询
	LBTSkipUrlType         int    `json:"lbt_skip_url_type" comment:"轮播图跳转 1内部/2外部"`
	Province               string `json:"province" comment:"适用地区"`
	common.ControlBy
}

func (s *SysConsultLBTInsertReq) Generate(model *models.SysConsultLBT) {
	//model.CourseId = s.CourseId
	model.ConsultLBTId = s.ConsultLBTId
	model.ConsultLBTName = s.ConsultLBTName
	model.LBTUrl = s.LBTUrl
	model.LBTSkipUrl = s.LBTSkipUrl
	model.ConsultLBTIntroduction = s.ConsultLBTIntroduction
	model.UploadUser = s.Creator
	model.LbtType = s.LbtType
	model.LBTStatus = "2"
	model.LBTSkipUrlType = s.LBTSkipUrlType
	model.Province = s.Province
}

func (s *SysConsultLBTInsertReq) GetId() interface{} {
	return s.ConsultLBTId
}

type SysConsultLBTUpdateReq struct {
	ConsultLBTId           int    `json:"consult_lbt_id" comment:"轮播图ID"`           // 轮播图ID
	ConsultLBTName         string `json:"consult_lbt_name" comment:"轮播图名称"`         // 轮播图名称
	LBTUrl                 string `json:"lbt_name_url" comment:"轮播图连接"`             // 轮播图连接
	LBTSkipUrl             string `json:"lbt_skip_url" comment:"轮播图跳转"`             // 轮播图跳转
	ConsultLBTIntroduction string `json:"consult_lbt_introduction" comment:"轮播图说明"` // 轮播图说明
	LBTStatus              string `json:"lbt_status" comment:"轮播图启用状态，1启用，2禁用"`     // 轮播图启用状态，1启用，2禁用
	LbtType                string `json:"lbt_type" comment:"图类型，1为首页，2为政策咨询"`       //图类型，1为首页，2为政策咨询
	LBTSkipUrlType         int    `json:"lbt_skip_url_type" comment:"轮播图跳转 1内部/2外部"`
	Province               string `json:"province" comment:"适用地区"`
	common.ControlBy
}

func (s *SysConsultLBTUpdateReq) Generate(model *models.SysConsultLBT) {
	if s.ConsultLBTId != 0 {
		model.ConsultLBTId = s.ConsultLBTId
	}
	if s.ConsultLBTName != "" {
		model.ConsultLBTName = s.ConsultLBTName

	}
	if s.LBTUrl != "" {
		model.LBTUrl = s.LBTUrl
	}
	if s.LBTSkipUrl != "" {
		model.LBTSkipUrl = s.LBTSkipUrl
	}
	if s.ConsultLBTIntroduction != "" {
		model.ConsultLBTIntroduction = s.ConsultLBTIntroduction
	}
	if s.LBTStatus == "1" || s.LBTStatus == "2" {
		model.LBTStatus = s.LBTStatus
	}
	if s.LbtType == "1" || s.LbtType == "2" {
		model.LbtType = s.LbtType
	}
	if s.LBTSkipUrlType == 1 || s.LBTSkipUrlType == 2 {
		model.LBTSkipUrlType = s.LBTSkipUrlType
	}
	if s.Province != "" {
		model.Province = s.Province
	}

	model.CreateBy = s.CreateBy
}

func (s *SysConsultLBTUpdateReq) GetId() interface{} {
	return s.ConsultLBTId
}

type SysConsultLBTGetReq struct {
	Id int `uri:"id"`
}

func (s *SysConsultLBTGetReq) GetId() interface{} {
	return s.Id
}

type SysConsultLBTDeleteReq struct {
	Ids []int `json:"ids"`
}

func (s *SysConsultLBTDeleteReq) GetId() interface{} {
	return s.Ids
}
